// 将重复率高的代码抽取到这
import { WrappedFormUtils } from "antd/lib/form/Form";

// antd的Form表单提交函数的封装
export const formSubmit = (e: React.FormEvent, form: WrappedFormUtils, callback: (values: any) => void) => {
  e.preventDefault(); //阻止跳转
  form.validateFields((err, values) => {
    if (!err) {
      callback(values);
    }
  });
};

// 表单子组件的布局
export const formItemLayout = {
  labelCol: {
    xs: { span: 24 },
    sm: { span: 4 }
  },
  wrapperCol: {
    xs: { span: 24 },
    sm: { span: 20 }
  }
};
